<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
 



















<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>文档审核</title>
<link href="../css/Default.css" rel="stylesheet" type="text/css" />
<script src="../scripts/Main.js"></script>
<script>
function add(){
	var catalogID = $V("CatalogID");
	if(catalogID==""){
		Dialog.alert("请选择栏目！");
		return;
	}
	var width  = (screen.availWidth-10)+"px";
  	var height = (screen.availHeight-50)+"px";
  	var leftm  = 0;
  	var topm   = 0;
  
 	var args = "toolbar=0,location=0,maximize=1,directories=0,status=0,menubar=0,scrollbars=0, resizable=1,left=" + leftm+ ",top=" + topm + ", width="+width+", height="+height;
  	var url="Article.jsp?CatalogID=" + catalogID;
  	var w = window.open(url,"",args);
  	if ( !w ){
		Dialog.alert( "发现弹出窗口被阻止，请更改浏览器设置，以便正常使用本功能!" ) ;
		return ;
	}
}

function del(){
	var arr = DataGrid.getSelectedValue("dg1");
	if(arr == null || arr.length==0){
		Dialog.alert("请先选择要删除的行！");
		return;
	}
	
	Dialog.confirm("确认删除选中的文档吗？",function(){
			var dc = new DataCollection();
			dc.add("IDs",arr.join());
			Server.sendRequest("com.zving.cms.document.ArticleList.del",dc,function(response){
				if(response.Status==0){
					Dialog.alert(response.Message);
				}else{
					Dialog.alert("成功删除文档");
					DataGrid.setParam("dg1","CatalogID",$V("CatalogID"));
					DataGrid.setParam("dg1",Constant.PageIndex,0);
		      DataGrid.loadData("dg1");
				}
			});
	});
}

function edit(id){
	var arr = DataGrid.getSelectedValue("dg1");
	if(arr == null || arr.length==0){
		Dialog.alert("请先选择要编辑的文章！");
		return;
	}
	var id = arr[0];
	var width  = (screen.availWidth-10)+"px";
	var height = (screen.availHeight-50)+"px";
	var leftm  = 0;
	var topm   = 0;
	var args = "toolbar=0,location=0,maximize=1,directories=0,status=0,menubar=0,scrollbars=0, resizable=1,left=" + leftm+ ",top=" + topm + ", width="+width+", height="+height;
	var url="Article.jsp?ArticleID=" + id;
	var w = window.open(url,"",args);
	if(!w){
		Dialog.alert( "发现弹出窗口被阻止，请更改浏览器设置，以便正常使用本功能!" ) ;
		return ;
	}
}

function onTreeClick(ele){
	var cid=  ele.getAttribute("cid");
	DataGrid.setParam("dg1","CatalogID",cid);
	DataGrid.loadData("dg1");
	$S("CatalogID",cid);
}

function delKeyWord() {
	if ($V("Keyword") == "请输入标题") {
		$S("Keyword","");
	}
}

function search(){
	DataGrid.setParam("dg1",Constant.PageIndex,0);
	if ($V("Keyword") != "请输入标题" && $V("Keyword") && $V("Keyword").trim()) {
		DataGrid.setParam("dg1","Keyword",$V("Keyword"));
	} else {
		DataGrid.setParam("dg1","Keyword","");
	}
	DataGrid.loadData("dg1");
}

document.onkeydown = function(event){
	event = getEvent(event);
	if(event.keyCode==13){
		var ele = event.srcElement || event.target;
		if(ele.id == 'Keyword'||ele.id == 'Submitbutton'){
			search();
		}
	}
}

function doAction(EntryID,ActionID,ArticleID){
	var dc = new DataCollection();
	dc.add("EntryID",EntryID);
	dc.add("ActionID",ActionID);
	dc.add("ArticleID",ArticleID);
	Server.sendRequest("com.zving.cms.document.Article.doAction",dc,function(response){
		Dialog.alert(response.Message,function(){
			if(response.Status==1){
   				DataGrid.loadData("dg1");
			}
		});
	});
}

function changeType(){
   	DataGrid.setParam("dg1",Constant.PageIndex,0);
	if ($V("Keyword") != "请输入标题" && $V("Keyword") && $V("Keyword").trim()) {
		DataGrid.setParam("dg1","Keyword",$V("Keyword"));
	} else {
		DataGrid.setParam("dg1","Keyword","");
	}
	DataGrid.setParam("dg1","Type",$V("Type"));
	DataGrid.loadData("dg1");
}

Page.onLoad(function(){
	$("article_applystep").disable();
	if($("BtnPublish")){
		$("BtnPublish").disable();
	}
	if($("BtnForceEnd")){
		$("BtnForceEnd").disable();
	}
});

function onRowClick(ele){
	var index = ele.rowIndex-1;
	if("Unread"==$("dg1").DataSource.Rows[index].get("State")){
		$("article_applystep").enable();
	}else{
		$("article_applystep").disable();
	}
	if($("BtnPublish")){
		if("20"==$("dg1").DataSource.Rows[index].get("Status")||"30"==$("dg1").DataSource.Rows[index].get("Status")){
			$("BtnPublish").enable();
		}else{
			$("BtnPublish").disable();
		}
	}
	if($("BtnForceEnd")){
		if("10"==$("dg1").DataSource.Rows[index].get("Status")){
			$("BtnForceEnd").enable();
		}else{
			$("BtnForceEnd").disable();
		}	}
}

function applyStep(){
	var dt = $("dg1").getSelectedData();
	if(!dt||dt.Rows.length==0){
		Dialog.alert("请先选择记录!");
		return;
	}
	for(var i=dt.Rows.length-1;i>=0;i--){
		if("Unread"!=dt.Rows[i].get("State")){
			dt.deleteRow(i);
		}
	}
	if(dt.Rows.length==0){
		Dialog.alert("选中的记录中没有处于待申请状态的!");
		return;
	}
	var dc = new DataCollection();
	dc.add("Data",dt);
	Server.sendRequest("com.zving.cms.document.WorkList.applyStep",dc,function(response){
		Dialog.alert(response.Message,function(){
			if(response.Status==1){
   				DataGrid.loadData("dg1");
			}
		});
	});
}

function articleLog(){
	var arr = DataGrid.getSelectedValue("dg1");
	if(arr == null || arr.length==0){
		Dialog.alert("请先选择要编辑的文章！");
		return;
	}
	var id = arr[0];
	var diag = new Dialog("Diag1");
	diag.Width = 680;
	diag.Height = 350;
	diag.Title = "处理历史";
	diag.URL = "Document/ArticleLogDialog.jsp?ArticleID="+id;
	diag.onLoad = function(){
	};
	diag.show();
	$E.hide(diag.OKButton);
	diag.CancelButton.value = "确 定";
}

function preview(){
	var arr = DataGrid.getSelectedValue("dg1");
	if(!arr || arr.length<1){
		Dialog.alert("请先选择要预览的文章！");
		return;
	}else{
		window.open("Preview.jsp?ArticleID="+arr[0]);
	}	
}

function publish(){
	var arr = DataGrid.getSelectedValue("dg1");
	if(arr == null || arr.length==0){
		Dialog.alert("请先选择要发布的文章！");
		return;
	}
	
	var dc = new DataCollection();
	dc.add("IDs",arr.join());
	Server.sendRequest("com.zving.cms.document.ArticleList.publish",dc,function(response){
		if(response.Status==0){
			Dialog.alert(response.Message);
		}else{
			var p = new Progress(response.get("TaskID"),"正在发布...");
			p.show(function(){
				$("dg1").loadData();
			});
		}
	});
}

function workflowConfig(){
	var dt = $("dg1").getSelectedData();
	if(!dt||dt.Rows.length==0){
		Dialog.alert("请先选择要查看流程的文章!");
		return;
	}
	var url = Server.ContextPath+"Workflow/WorkflowDetail.jsp?ID="+dt.get(0,"workflowconfigid");
	var width  = (screen.availWidth-10)+"px";
    var height = (screen.availHeight-50)+"px";
    var left  = 0;
    var top   = 0;
 	var args = "toolbar=0,location=0,maximize=1,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,left=" + left+ ",top=" + top + ", width="+width+", height="+height;
    var w = window.open(url,"",args);
    if ( !w ){
		Dialog.alert( "发现弹出窗口被阻止，请更改浏览器设置，以便正常使用本功能!" ) ;
		return ;
	}
}

function forceEnd(){
	var dt = $("dg1").getSelectedData();
	if(!dt||dt.Rows.length==0){
		Dialog.alert("请先选择记录!");
		return;
	}
	for(var i=dt.Rows.length-1;i>=0;i--){
		if("10"!=dt.Rows[i].get("Status")){
			dt.deleteRow(i);
		}
	}
	if(dt.Rows.length==0){
		Dialog.alert("选中的记录中没有处于流转中状态的!");
		return;
	}
	var dc = new DataCollection();
	dc.add("Data",dt);
	Server.sendRequest("com.zving.cms.document.WorkList.forceEnd",dc,function(response){
		Dialog.alert(response.Message,function(){
			if(response.Status==1){
   				DataGrid.loadData("dg1");
			}
		});
	});
}
</script>
</head>
<body>
<input type="hidden" id="CatalogID">
<input type="hidden" id="ListType" value='${ListType}'>
<table width="100%" border="0" cellspacing="6" cellpadding="0" style="border-collapse: separate; border-spacing: 6px;">
	<tr valign="top">
		<td></td>
		<td>
		<table width="100%" border="0" cellspacing="0" cellpadding="4" class="blockTable">
			<tr>
				<td colspan="2" valign="middle" class="blockTd"><img src="../images/icons/icon018a1.gif" />文档审核列表</td>
			</tr>
			<tr>
				<td style="padding:0 8px 4px;">
				<a href='javascript:void(0);' ztype='zPushBtn' class='zPushBtn' hidefocus='true' tabindex='-1' onselectstart='return false' id='' onClick="DataGrid.edit(event,'dg1');return false;" priv="true" ><img src="../images/icons/icon018a4.gif" /><b>打开&nbsp;</b></a> 
				<a href='javascript:void(0);' ztype='zPushBtn' class='zPushBtn' hidefocus='true' tabindex='-1' onselectstart='return false' id='article_applystep' onClick="applyStep();return false;" ><img src="../images/icons/icon018a16.gif" width="20" height="20" /><b>申请处理&nbsp;</b></a> 
				<a href='javascript:void(0);' ztype='zPushBtn' class='zPushBtn' hidefocus='true' tabindex='-1' onselectstart='return false' id='article_manage' onClick="del();return false;" ><img src="../images/icons/icon018a3.gif" /><b>删除&nbsp;</b></a>
				<a href='javascript:void(0);' ztype='zPushBtn' class='zPushBtn' hidefocus='true' tabindex='-1' onselectstart='return false' id='article_manage' onClick="articleLog();return false;" ><img src="../images/icons/icon_column.gif" width="20" height="20" /><b>处理历史&nbsp;</b></a>
				
				<a href='javascript:void(0);' ztype='zPushBtn' class='zPushBtn' hidefocus='true' tabindex='-1' onselectstart='return false' id='BtnPublish' onClick="publish();return false;" priv="article_modify" ><img src="../images/icons/icon003a13.gif" width="20" height="20" /><b>发布&nbsp;</b></a>
				<a href='javascript:void(0);' ztype='zPushBtn' class='zPushBtn' hidefocus='true' tabindex='-1' onselectstart='return false' id='BtnPreview' onClick="preview();return false;" priv="article_browse" ><img src="../images/icons/icon403a3.gif" width="20" height="20" /><b>预览&nbsp;</b></a>
				
				<a href='javascript:void(0);' ztype='zPushBtn' class='zPushBtn' hidefocus='true' tabindex='-1' onselectstart='return false' id='BtnWorkflowConfig' onClick="workflowConfig();return false;" ><img src="../images/icons/icon042a1.gif" width="20" height="20" /><b>查看流程&nbsp;</b></a>
					<div id='Type' name='Type' selectedIndex='0' ztype='Select' class='zSelect' style="display:inline-block; *zoom: 1;*display: inline;vertical-align:middle;position:relative;height:20px;white-space: nowrap;width:110px;" styleOriginal="width:110px;" onChange="changeType()" defaultblank="false"><input type='text' id='Type_textField' ztype='select' autocomplete='off' name="Type" style="vertical-align:top; background:transparent none; cursor:default;width:110px;" value=''/><img class='arrowimg' src='../images/blank.gif' width='18' height='20' id='Type_arrow' style='position:relative; left:-17px; margin-right:-18px; cursor:pointer; width:18px; height:20px;vertical-align:top;'/><div id='Type_list' class='optgroup' style='text-align:left;display:none;'><div id='Type_ul' style='left:-1px; width:-1px;'><a href="javascript:void(0);" onclick="Selector.onItemClick(this);" onmouseover='Selector.onItemMouseOver(this)'  hidefocus value="TOME">待我处理的文档</a><a href="javascript:void(0);" onclick="Selector.onItemClick(this);" onmouseover='Selector.onItemMouseOver(this)'  hidefocus value="HANDLED">我处理过的文档</a>
				</div></div></div><input name="Keyword" type="text" id="Keyword" value="请输入标题" onFocus="delKeyWord();" style="width:100px"> <input type="button" name="Submitbutton" id="Submitbutton" value="查询" onClick="search()"></td>
			</tr>
			<tr>
				<td style="padding-top:0px;padding-left:6px;padding-right:6px;padding-bottom:8px;"><table width="100%" cellpadding="2" cellspacing="0" class="dataTable" sortstring="" id="dg1" page="true" size="0" method="com.zving.cms.document.WorkList.dg1DataBind" multiselect="true" autofill="true" scroll="false" lazy="false" cachesize="0">
<tr ztype="head" class="dataTableHead">
<td width="3%" height="30" ztype="RowNo">&nbsp;</td>
<td width="2%" ztype="selector" field="id"><input type='checkbox' value='*' id='dg1_AllCheck' onclick="DataGrid.onAllCheckClick('dg1')"/></td>
<td width="10%"><b>所属栏目</b></td>
<td width="28%"><b>标题</b></td>
<td width="8%"><strong>创建者</strong></td>
<td width="10%"><strong>添加时间</strong></td>
<td width="8%"><strong>文档状态</strong></td>
<td width="8%"><strong>上次动作</strong></td>
<td width="7%"><strong>当前步骤</strong></td>
<td width="8%"><strong>标志</strong></td>
<td width="8%"><strong>处理者</strong></td>
</tr>
<tr ztype="blank" height="345">
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<script ztype="DataGrid">Page.onLoad(DataGrid_dg1_Init,9);function DataGrid_dg1_Init(){var _Zving_Cols = [["CatalogIDName",1],["id",7],["catalogid",7],["cataloginnercode",1],["title",1],["workflowid",7],["adduser",1],["addtime",0],["status",7],["workflowconfigid",7],["AllowOrgan",1],["AllowRole",1],["AllowUser",1],["Owner",1],["State",1],["StateName",1],["StepName",1],["NodeID",8],["ActionID",8],["ActionName",1],["statusName",1],["_RowNo",8]]
var _Zving_Values = [];
$('dg1').DataSource = new DataTable();$('dg1').DataSource.init(_Zving_Cols,_Zving_Values);var _Zving_Arr = [];_Zving_Arr.push("&nbsp;");_Zving_Arr.push("&nbsp;");_Zving_Arr.push("$\{CatalogIDName}");_Zving_Arr.push("$\{Title}");_Zving_Arr.push("$\{AddUser}");_Zving_Arr.push("$\{AddTime}");_Zving_Arr.push("$\{StatusName}");_Zving_Arr.push("$\{ActionName}");_Zving_Arr.push("$\{StepName}");_Zving_Arr.push("$\{StateName}");_Zving_Arr.push("$\{Owner}");$('dg1').TemplateArray = _Zving_Arr;$('dg1').TagBody = "&lt;table&nbsp;width=&quot;100%&quot;&nbsp;cellpadding=&quot;2&quot;&nbsp;cellspacing=&quot;0&quot;&nbsp;class=&quot;dataTable&quot;&gt;&nbsp;&lt;tr&nbsp;ztype=&quot;head&quot;&nbsp;class=&quot;dataTableHead&quot;&gt;&nbsp;&lt;td&nbsp;width=&quot;3%&quot;&nbsp;height=&quot;30&quot;&nbsp;ztype=&quot;RowNo&quot;&gt;&lt;/td&gt;&nbsp;&lt;td&nbsp;width=&quot;2%&quot;&nbsp;ztype=&quot;selector&quot;&nbsp;field=&quot;id&quot;&gt;&amp;nbsp;&lt;/td&gt;&nbsp;&lt;td&nbsp;width=&quot;10%&quot;&gt;&lt;b&gt;&#25152;&#23646;&#26639;&#30446;&lt;/b&gt;&lt;/td&gt;&nbsp;&lt;td&nbsp;width=&quot;28%&quot;&gt;&lt;b&gt;&#26631;&#39064;&lt;/b&gt;&lt;/td&gt;&nbsp;&lt;td&nbsp;width=&quot;8%&quot;&gt;&lt;strong&gt;&#21019;&#24314;&#32773;&lt;/strong&gt;&lt;/td&gt;&nbsp;&lt;td&nbsp;width=&quot;10%&quot;&gt;&lt;strong&gt;&#28155;&#21152;&#26102;&#38388;&lt;/strong&gt;&lt;/td&gt;&nbsp;&lt;td&nbsp;width=&quot;8%&quot;&gt;&lt;strong&gt;&#25991;&#26723;&#29366;&#24577;&lt;/strong&gt;&lt;/td&gt;&nbsp;&lt;td&nbsp;width=&quot;8%&quot;&gt;&lt;strong&gt;&#19978;&#27425;&#21160;&#20316;&lt;/strong&gt;&lt;/td&gt;&nbsp;&lt;td&nbsp;width=&quot;7%&quot;&gt;&lt;strong&gt;&#24403;&#21069;&#27493;&#39588;&lt;/strong&gt;&lt;/td&gt;&nbsp;&lt;td&nbsp;width=&quot;8%&quot;&gt;&lt;strong&gt;&#26631;&#24535;&lt;/strong&gt;&lt;/td&gt;&nbsp;&lt;td&nbsp;width=&quot;8%&quot;&gt;&lt;strong&gt;&#22788;&#29702;&#32773;&lt;/strong&gt;&lt;/td&gt;&nbsp;&lt;/tr&gt;&nbsp;&lt;tr&nbsp;onDblClick=&quot;edit($\{ID});&quot;&nbsp;onclick=&quot;onRowClick(this)&quot;&gt;&nbsp;&lt;td&gt;&amp;nbsp;&lt;/td&gt;&nbsp;&lt;td&gt;&amp;nbsp;&lt;/td&gt;&nbsp;&lt;td&gt;$\{CatalogIDName}&lt;/td&gt;&nbsp;&lt;td&gt;$\{Title}&lt;/td&gt;&nbsp;&lt;td&gt;$\{AddUser}&lt;/td&gt;&nbsp;&lt;td&gt;$\{AddTime}&lt;/td&gt;&nbsp;&lt;td&gt;$\{StatusName}&lt;/td&gt;&nbsp;&lt;td&gt;$\{ActionName}&lt;/td&gt;&nbsp;&lt;td&gt;$\{StepName}&lt;/td&gt;&nbsp;&lt;td&gt;$\{StateName}&lt;/td&gt;&nbsp;&lt;td&gt;$\{Owner}&lt;/td&gt;&nbsp;&lt;/tr&gt;&nbsp;&lt;tr&nbsp;ztype=&quot;pagebar&quot;&gt;&nbsp;&lt;td&nbsp;colspan=&quot;10&quot;&nbsp;align=&quot;left&quot;&gt;$\{PageBar}&lt;/td&gt;&nbsp;&lt;/tr&gt;&nbsp;&lt;/table&gt;";DataGrid.setParam('dg1','_ZVING_PAGEINDEX',0);DataGrid.setParam('dg1','_ZVING_PAGETOTAL',0);DataGrid.setParam('dg1','_ZVING_SIZE',15);DataGrid.setParam('dg1','_ZVING_MULTISELECT','true');DataGrid.setParam('dg1','_ZVING_AUTOFILL','true');DataGrid.setParam('dg1','_ZVING_SCROLL','false');DataGrid.setParam('dg1','_ZVING_LAZY','false');DataGrid.init('dg1');}</script>
<tr ztype="pagebar" dragover="DataGrid.dragOver" dragout="DataGrid.dragOut" dragend="DataGrid.dragEnd">
<td colspan="11" align="left" id="dg1_PageBar"><div style='float:right;font-family:Tahoma'>第一页&nbsp;|&nbsp;上一页&nbsp;|&nbsp;下一页&nbsp;|&nbsp;最末页&nbsp;&nbsp;&nbsp;&nbsp;转到第&nbsp;<input id='_PageBar_Index' type='text' class='inputText' style='width:40px' onKeyUp="value=value.replace(/\D/g,'')">&nbsp;页&nbsp;&nbsp;<input type='button' onclick="if(!/^\d+$/.test($V('_PageBar_Index'))||$V('_PageBar_Index')<1||$V('_PageBar_Index')>0){alert('错误的页码');$('_PageBar_Index').focus();}else{var pageIndex = ($V('_PageBar_Index')-1)>0?$V('_PageBar_Index')-1:0;DataGrid.setParam('dg1','_ZVING_PAGEINDEX',pageIndex);DataGrid.loadData('dg1');}" class='inputButton' value='跳转'></div><div style='float:left;font-family:Tahoma'>共 0 条记录，每页 15 条，当前第 0 / 0 页</div></td>
</tr>
</table></td>
			</tr>
		</table>
		</td>
	</tr>
</table>
</body>
</html>
